package com.ioc.aware;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author cyt
 * @create 2020-08-01 14:00
 */
@Component
public class RedAware implements ApplicationContextAware, BeanNameAware {

    private ApplicationContext applicationContext;

    private String name;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("RedAware  applicationContext => " + applicationContext);
        this.applicationContext = applicationContext;
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("RedAware  name  => " + s);
        this.name = s;
    }
}
